Skip to content

support custom hostnames#6

Merged
skarim merged 1 commit intomainfrom
skarim/ghes-custom-hostname-support
Mar 25, 2026
Merged

support custom hostnames#6
skarim merged 1 commit intomainfrom
skarim/ghes-custom-hostname-support

Conversation

@skarim
Copy link
Copy Markdown
Collaborator

@skarim skarim commented Mar 25, 2026

Support for custom hostnames:

  • Updated the ghapi.NewClient function and its usage throughout the codebase to accept a host parameter, enabling API calls to work with both github.com and GHES instances. (internal/github/github.go, internal/config/config.go, cmd/view.go) [1] [2] [3]
  • Refactored code in cmd/view.go to pass the repository host where needed, including in functions that display PR information and construct PR URLs. [1] [2] [3] [4] [5]

URL construction improvements:

  • Added a new PRURL function in internal/github/github.go to generate pull request URLs for any host, and updated all relevant call sites to use this utility. [1] [2] [3]

Testing:

  • Added a new test file internal/github/github_test.go with tests for the PRURL function, covering github.com, GHES hosts, and the defaulting behavior.
  • Extended cmd/utils_test.go to include test cases for parsing PR URLs from GHES instances.

Copilot AI review requested due to automatic review settings March 25, 2026 21:54
Copy link
Copy Markdown

Copilot AI commented Mar 25, 2026

Warning

This is an internal experiment to assess Copilot's ability to auto-approve PRs. Please 👍 this comment if the assessment below is correct and 👎 if not. Feedback in #f-ccr-auto-approve is appreciated!

Copilot thinks this PR is ready to approve and merge.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds GitHub Enterprise Server (GHES) hostname support to GitHub API client creation and PR URL rendering, so the CLI can operate correctly against non-github.com hosts.

Changes:

  • Extend the internal GitHub API client constructor to accept a host and create host-scoped REST/GraphQL clients.
  • Add a shared PRURL() helper and use it in gh stack view output instead of hardcoding github.com.
  • Add unit tests for PRURL() and expand PR URL parsing tests to cover GHES hosts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/github/github.go Adds host support to NewClient and introduces PRURL() for host-aware PR links.
internal/github/github_test.go New unit test coverage for PRURL() across github.com, GHES, and empty-host defaulting.
internal/config/config.go Passes the detected repository host into ghapi.NewClient(...).
cmd/view.go Uses the repo host to render PR links via ghapi.PRURL(...) in both short and full views.
cmd/utils_test.go Adds GHES examples to ensure PR URL parsing is host-agnostic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/github/github.go
@skarim skarim merged commit 0f67464 into main Mar 25, 2026
7 checks passed
@skarim skarim deleted the skarim/ghes-custom-hostname-support branch March 25, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants